<?php
/**
 * Created by PhpStorm.
 * User: yafex
 * Date: 2020/9/15
 * Time: 17:00
 */
class ctrl_wish_scanShip extends L {

    /**
     * 描述 : 扫描发货页面
     * 作者 : Zoro.Zhu
     */
    public function index(){
        $this->view->headTitle = '扫描发货';
        $this->display('/html/wish/scanShip.html');
    }

    /**
     * 描述 : 获取订单信息
     * 作者 : Zoro.Zhu
     */
    public function getOrderInfo() {
        $singleExpress = $_POST['singleExpress'];
        $orderInfo = L::sql("SELECT
            orderId, orderState, dxmAccount, singleExpress, orderData
        FROM
            dxm_order
        WHERE
            singleExpress = '{$singleExpress}'");
        if(empty($orderInfo)){
            return ['state' => 300, 'info' => '未查询到对应订单'];
        }
        $data = [];
        $logisticsList = model_dxmOrder::getLogisticsList();
        foreach ($orderInfo as $key => $row) {
            $data[$key] = json_decode($row['orderData'], true);
            $data[$key]['dxmAccount'] = $row['dxmAccount'];
            $data[$key]['logisticsId'] = !empty($logisticsList[$data[$key]['logistics']]) ? $logisticsList[$data[$key]['logistics']] : '';
            $user = L::sql("SELECT
                b.nike
            FROM
                `vs_account_cookie` a LEFT JOIN _of_sso_user_attr b on a.addName = b.`name`
            WHERE
                a.account = '{$row['dxmAccount']}'");
            $data[$key]['user'] = $user[0]['nike'];
        }
        return ['state' => 200, 'info' => '获取成功', 'data' => $data];
    }

}
return true;